﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PJ.Data;

namespace PJ.Business
{
    /// <summary>
    /// <see cref="IItem"/> services interface
    /// </summary>
    public interface IItemService : IEntityService
    {
        /// <summary>
        /// Gets the item
        /// </summary>
        /// <param name="name">Item name</param>
        /// <returns>The item instance</returns>
        /// <exception cref="ArgumentNullException">If <paramref name="name"/> is <see langref="null"/> or empty.</exception>
        /// <exception cref="DataNotFoundException">If the item with the given name does not exist.</exception>
        IItem GetByName(string name, GetDataMode mode);

        /// <summary>
        /// Gets the item
        /// </summary>
        /// <param name="aliasName">Item aliasName</param>
        /// <returns>The item instance</returns>
        /// <exception cref="ArgumentNullException">If <paramref name="aliasName"/> is <see langref="null"/> or empty.</exception>
        /// <exception cref="DataNotFoundException">If the item with the given aliasName does not exist.</exception>
        IItem GetByAlias(string aliasName, GetDataMode mode);


        /// <summary>
        /// Searchs the Item that match the given criteria
        /// </summary>
        /// <param name="searchText">search criteria</param>
        /// <returns>Collection of Item global ids</returns>
        /// <exception cref="ArgumentNullException">If <paramref cref="searchText"/> is <see langref="null"/> or empty.</exception>
        string[] Search(string searchText, GetDataMode mode);

    }

    /// <summary>
    /// <see cref="IItem"/> services interface
    /// </summary>
    /// <typeparam name="TIItem">Business <see cref="IItem">Item</see> interface type</typeparam>
    public interface IItemService<TIItem> : IEntityService<TIItem>, IItemService
        where TIItem : class, IItem
    {
        /// <summary>
        /// Gets the item
        /// </summary>
        /// <param name="name">Item name</param>
        /// <returns>The item instance</returns>
        /// <exception cref="ArgumentNullException">If <paramref name="name"/> is <see langref="null"/> or empty.</exception>
        /// <exception cref="DataNotFoundException">If the item with the given name does not exist.</exception>
        new TIItem GetByName(string name, GetDataMode mode);


        /// <summary>
        /// Gets the item
        /// </summary>
        /// <param name="name">Item aliasName</param>
        /// <returns>The item instance</returns>
        /// <exception cref="ArgumentNullException">If <paramref name="aliasName"/> is <see langref="null"/> or empty.</exception>
        /// <exception cref="DataNotFoundException">If the item with the given aliasName does not exist.</exception>
        new TIItem GetByAlias(string aliasName, GetDataMode mode);

    }
}
